package com.zzzyh.bookbackgroundsystem.advice;

import com.zzzyh.bookbackgroundsystem.pojo.Response;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@Slf4j
@ControllerAdvice
@ResponseBody
public class ErrorAdvice {
    @ExceptionHandler
    public Response handleError(Exception e) {
        log.error("error:{}", e.getMessage());
        return Response.error("内部错误");
    }
}
